druntime: Move accumulatePure from core.internal.array to rt.profilegc#23408
Conversation
`rt.profilegc`
3ee42d9 to
e5684b4
Compare
|
cc @dkorpel as you wrote the fix for master, and this PR seems to do it slightly differently to what you did (and may cause merge conflicts). |
This reverts commit 5f9d508.
|
This hasn't been working so far. CTFE tries to instantiate the hooks, causing weird bugs. |
|
Okay, I think I coaxed it into working...still some test failures to figure out. |
|
Oh right, this seems to be more trouble than expected - currently hitting an assertion in the DMD glue layer. Using a hardcoded mangle and avoiding the diff --git a/druntime/src/core/internal/array/utils.d b/druntime/src/core/internal/array/utils.d
index 54757c0faf..3a01e89d3e 100644
--- a/druntime/src/core/internal/array/utils.d
+++ b/druntime/src/core/internal/array/utils.d
@@ -23,13 +23,8 @@ auto gcStatsPure() nothrow pure
version (D_ProfileGC)
{
- // Needs to be templated to emit only as needed.
- ulong accumulatePure()(string file, int line, string funcname, string name, ulong size) @nogc nothrow pure
- {
- import core.internal.traits : externDFunc;
- alias impl = externDFunc!("rt.profilegc.accumulatePure", ulong function(string file, int line, string funcname, string name, ulong size) @nogc nothrow pure);
- return impl(file, line, funcname, name, size);
- }
+ pragma(mangle, "_D2rt9profilegc14accumulatePureFNaNbNiAyaiQeQgmZm")
+ ulong accumulatePure(string file, int line, string funcname, string name, ulong size) @nogc nothrow pure;
/**
* TraceGC wrapper generator around the runtime hook `Hook`.For context: v2.113's |
|
Its not #23417 perchance? |
Moves
accumulatePure(which is a thin wrapper aroundrt.profilegc.accumulate, adding forcing purity on it) out ofcore.internal.arrayand intort.profilegc.This helps prevent
rt.profilegcfrom being dragged in (and thus its module destructors) whenD_ProfileGCisn't enabled, reducing the size of statically linked binaries.See ldc-developers/ldc#5186 (comment)
This problem should be solved on
masterby #22859. This improvement is for 1.113.